<?php
/**
 * npc管理模块
 *
 * @author river_he@eueang.com
 */
final class Kit_Model_Npc extends Kit_Model_Abstract{
	
	/**
	 * 获取多条npc记录
	 * 
	 * @param array|string $where
	 * @param string $sort
	 * @param int $page
	 * @param int $psize
	 * @return array
	 */
	public function getItems($where, $sort='', $page=1, $psize=10){
		$return = array();
		$data = $this->getNpcDao()->getItems($where, $sort, $page, $psize);
		if($data){
			$psize = $psize>0?$psize:10;
			$page = $page>0?$page:1;
			$return['data'] = $data;
			$total = $this->getNpcDao()->getWhereTotal($where);
			$return['pager'] = array(
			'rtotal'=>$total,
			'page'=>$page,
			'psize'=>$psize,
			'ptotal'=>ceil($total/$psize)
			);
		}
		return $return;
	}
	
	/**
	 * 获取npc单条记录
	 * 
	 * @param string|array $where
	 * @param string $sort
	 * @return array
	 */
	public function getItem($where, $sort=''){
		$return = array();
		if($where){
			$return = $this->getNpcDao()->getItem($where, $sort);
		}
		return $return;
	}
}
//end